#ifndef YEPXML_TESTWRITING_HPP
#define YEPXML_TESTWRITING_HPP

#include <iostream>
#include <cstdlib>
#include "YepXML.hpp"

using namespace std;
using namespace yxml;


inline int testWriting()
{
    Document doc( "Arvore" );
    doc.attribute( "altura" ) = "30 m";
    doc.attribute( "idade" ) = "100 anos";
    doc.setAttribute( "id", 5);
    Node& galho1 = doc.addChild( TAG, "galho" );
    Node& galho2 = doc.addChild( TAG, "galho" );
    galho1.attribute( "altura" ) = "15 m";
    galho1.addChild( TEXT, "Eu tenho folhas!" );
    galho1.addChild( TAG, "folha" );
    galho1.addChild( TAG, "folha" );
    galho2.addChild( TAG, "folha" );
    galho2.addChild( TAG, "folha" );
    galho2.addChild( COMMENT, "E tem mais uma", 1 );
    cout << "\tHierarchical (Deprecated)"<<endl;
    HierarchicalWritterDeprecated hierarchicalWritterDeprecated( cout );
    hierarchicalWritterDeprecated.write( doc );
    cout << endl <<"=================================="<<endl;
    cout << "\tContinuum"<<endl;
    Writter writter( cout );
    writter.write( doc );
    cout << endl <<"=================================="<<endl;
    cout << "\tLine separated"<<endl;
    LineSeparatedWritter lineSeparatedwritter( cout );
    lineSeparatedwritter.write( doc );
    cout << endl <<"=================================="<<endl;
    cout << "\tHierarchical"<<endl;
    HierarchicalWritter hierarchicalWritter( cout );
    hierarchicalWritter.write( doc );
    cout << endl <<"=================================="<<endl;
    return EXIT_SUCCESS;
}

#endif // YEPXML_TESTWRITING_HPP
